package tedu.api.thread;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) throws IOException {
        System.out.println("程序开始了");

        //Scanner scan = new Scanner(System.in);
        //int num = scan.nextInt();

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();//读取一行字符串
        int num = Integer.parseInt(line);//将字符串转换为整数

        //int i=num
        for(;num>0;num--){
            System.out.println(num);
            try {
                Thread.sleep(1000);//
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("时间到!");

        /*try {
            Thread.sleep(5000);//主线程执行时会阻塞5秒
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
        System.out.println("程序结束了");

    }
}
